package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.bjesc_b2c.app.appraiset.R;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.ToDayBean;

/**
 * Created by Jason Chen on 2017/2/20.
 */

public class ToDayPlanAdapter extends CommonAdapter<ToDayBean> {


    public ToDayPlanAdapter(Context context, int layoutId, List<ToDayBean> datas) {
        super(context, layoutId, datas);
    }
    @Override
    protected void convertView(ViewHolder holder, ToDayBean o, int position) {
        String statusType = o.getStatus_type(); //检测状态
       if(!TextUtils.isEmpty(o.getSpecific_address())){
           holder.setText(R.id.tv_item_dealer_address,
                   "车行地址: "+o.getSpecific_address());    //车行地址
       }
        if(!TextUtils.isEmpty(o.getOwner_name())){
            holder.setText(R.id.tv_item_dealer_name,"车行名称: "+o.getOwner_name());              //车行名称
        }
        if(!TextUtils.isEmpty(o.getBrand_name())){
            holder.setText(R.id.tv_car_brand,o.getBrand_name());               //设置车品牌
        }
        if (!TextUtils.isEmpty(o.getSeries_name())){
            holder.setText(R.id.tv_item_car_style,"车辆款型："+o.getSeries_name());
        }
        holder.setText(R.id.tv_detection_status,statusType);        //设置检查状态
//        holder.setText(R.id.tv_action_status,o.getActionStatus());           //设置动作状态
        if("未检测".equals(statusType)){
            //红色
            holder.setBackgroundDrawable(R.id.tv_detection_status,mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_red));
//            holder.setText(R.id.tv_appointment_time,"预约时间: "+o.getMaking_time());    //设置预约时间
        }else{
            //黄色
            holder.setBackgroundDrawable(R.id.tv_detection_status,mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_yellow));
//            holder.setText(R.id.tv_appointment_time,"检测时间: "+o.getExamines_time());    //设置预约时间
        }

        if(1 ==1 ){ //设置动作状态颜色
            //蓝色
            holder.setBackgroundDrawable(R.id.tv_action_status,mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_blue));
        }else{
            //绿色
            holder.setBackgroundDrawable(R.id.tv_action_status,mContext.getResources().getDrawable(R.drawable.shape_todayplan_item_label_green));
        }

    }
}
